package com.aboo.trade.service;

import com.aboo.trade.domain.PlatformPO;
import com.aboo.trade.mapper.PlatformMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

@Service
public class PlatformService {

    @Resource
    private PlatformMapper platformMapper;

    //    @Transactional(value = "tradeTransactionManager", propagation = Propagation.REQUIRED)
    public int savePlatform(PlatformPO platform) {
        if (platform == null) {
            return 0;
        }

        int ctn = platformMapper.insertPlatform(platform);

        Integer.parseInt("a");

        LocalTime lt = LocalTime.now();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
        String timestr = dtf.format(lt);
        platformMapper.updatePlatform(timestr);

        return ctn;
    }

}
